package com.stepview;

import android.app.Activity;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import java.util.Arrays;

public class MainActivity extends Activity {

    String[] step1 = new String[]{"你瞅啥"};
    String[] step2 = new String[]{"你瞅啥", "瞅你咋地"};
    String[] step3 = new String[]{"你瞅啥", "瞅你咋地", "再瞅下试试"};
    String[] step4 = new String[]{"你瞅啥", "瞅你咋地", "再瞅下试试", "试试就试试"};
    String[] step5 = new String[]{"已下单", "已发货", "配送中", "待收货", "已收货"};
    ProgressView p1, p2, p3, p4, p5;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        p1 = findViewById(R.id.indicator_1);
        p2 = findViewById(R.id.indicator_2);
        p3 = findViewById(R.id.indicator_3);
        p4 = findViewById(R.id.indicator_4);
        p5 = findViewById(R.id.indicator_5);

        p1.setIndicateSteps(Arrays.<CharSequence>asList(step1));
        p2.setIndicateSteps(Arrays.<CharSequence>asList(step2));
        p3.setIndicateSteps(Arrays.<CharSequence>asList(step3));
        p4.setIndicateSteps(Arrays.<CharSequence>asList(step4));
        p5.setIndicateSteps(Arrays.<CharSequence>asList(step5));
    }

    public void bottom(View view) {
        p1.setMode(ProgressView.MODE_BOTTOM);
        p2.setMode(ProgressView.MODE_BOTTOM);
        p3.setMode(ProgressView.MODE_BOTTOM);
        p4.setMode(ProgressView.MODE_BOTTOM);
        p5.setMode(ProgressView.MODE_BOTTOM);
    }

    public void top(View view) {
        p1.setMode(ProgressView.MODE_TOP);
        p2.setMode(ProgressView.MODE_TOP);
        p3.setMode(ProgressView.MODE_TOP);
        p4.setMode(ProgressView.MODE_TOP);
        p5.setMode(ProgressView.MODE_TOP);
    }
}
